/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.max.oti.system.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author max
 */
@Entity
@Table(name = "sustentation_practice", catalog = "dbfiis", schema = "public")
@XmlRootElement
public class SustentationPractice implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "date_sustentation")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateSustentation;
    @Basic(optional = false)
    @Column(name = "place")
    private String place;
    @Column(name = "note_final")
    private Integer noteFinal;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idSustentationPractice")
    private List<Jury> juryList = new ArrayList<Jury>();
    @JoinColumn(name = "id_practice", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Practice idPractice;

    public SustentationPractice() {
    }

    public SustentationPractice(Integer id) {
        this.id = id;
    }

    public SustentationPractice(Integer id, Date dateSustentation, String place) {
        this.id = id;
        this.dateSustentation = dateSustentation;
        this.place = place;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getDateSustentation() {
        return dateSustentation;
    }

    public void setDateSustentation(Date dateSustentation) {
        this.dateSustentation = dateSustentation;
    }

    public String getPlace() {
        return place;
    }

    public void setPlace(String place) {
        this.place = place;
    }

    public Integer getNoteFinal() {
        return noteFinal;
    }

    public void setNoteFinal(Integer noteFinal) {
        this.noteFinal = noteFinal;
    }

    @XmlTransient
    public List<Jury> getJuryList() {
        return juryList;
    }

    public void setJuryList(List<Jury> juryList) {
        this.juryList = juryList;
    }

    public Practice getIdPractice() {
        return idPractice;
    }

    public void setIdPractice(Practice idPractice) {
        this.idPractice = idPractice;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SustentationPractice)) {
            return false;
        }
        SustentationPractice other = (SustentationPractice) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.SustentationPractice[ id=" + id + " ]";
    }
    
}
